Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 24: Adding Sound

../ch24/24fig06.gif
Figure 24.6

An ambient sound aimed to the right.

24fig06.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
    # Directed sound emitter
        Sound {
            source AudioClip {
                url "willow1.wav"
                loop TRUE
            }
            direction 1.0 0.0 0.0
            minFront 5.0
            minBack  1.0
            maxFront 10.0
            maxBack  2.0
        },
    # Emitter marker
        Shape {
            appearance Appearance {
                material Material {
                    diffuseColor  0.0 0.0 0.0
                    emissiveColor 1.0 1.0 1.0
                }
            }
            geometry Sphere { radius 0.25 }
        },
    # Minimum range ellipsoid marker
        Transform {
            translation 2.0 0.0 0.0
            scale 3.0 2.0 2.0
            children DEF MinMarker Shape {
                appearance Appearance {
                    material Material {
                        diffuseColor  0.0 0.0 0.0
                        emissiveColor 1.0 0.0 0.5
                    }
                }
                geometry Cylinder {
                    radius 1.0
                    height 0.01
                    side   FALSE
                    bottom FALSE
                }
            }
        },
    # Maximum range ellipsoid marker
        Transform {
            translation 4.0 0.0 0.0
            scale 6.0 4.0 4.0
            children DEF MaxMarker Shape {
                appearance Appearance {
                    material Material {
                        diffuseColor  0.0 0.0 0.0
                        emissiveColor 0.5 0.0 1.0
                    }
                }
                geometry Cylinder {
                    radius 1.0
                    height 0.001
                    side   FALSE
                    bottom FALSE
                }
            }
        }
    ]
}